package com.sunchen.asc.service.log.server;

import com.sunchen.asc.service.log.api.LogAspectService;
import com.sunchen.asc.service.log.domain.Log;
import com.sunchen.asc.service.log.dto.LogDto;
import com.sunchen.asc.service.log.repository.LogRepository;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService(retries = 0)
public class LogAspectServiceImpl implements LogAspectService {

    @Autowired
    LogRepository logRepository;


    public void addLog(LogDto logDto) {
        Log log = new Log();
        log.setTerminal(logDto.getTerminal());
        log.setUser(logDto.getUser());
        log.setCreateTime(logDto.getCreateTime());
        log.setDetail(logDto.getDetail());
        log.setIp(logDto.getIp());
        log.setBrowser(logDto.getBrowser());

        logRepository.save(log);

    }
}
